unit uniCadCondPagamento;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uniCadPadrao, DB, ADODB, ExtCtrls, Buttons, StdCtrls, Mask,
  DBCtrls;

type
  TfrmCadCondPagamento = class(TfrmCadPadrao)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    DBText1: TDBText;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    Label4: TLabel;
    DBEdit1: TDBEdit;
    DBEdit3: TDBEdit;
    Label5: TLabel;
    DBEdit4: TDBEdit;
    procedure DBEdit2Enter(Sender: TObject);
    procedure DBEdit2Exit(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    procedure p_Select;
  public
    { Public declarations }
  end;

var
  frmCadCondPagamento: TfrmCadCondPagamento;

implementation

uses uniFuncBD, UniFuncoes;

{$R *.dfm}

{ TfrmCadCondPagamento }

procedure TfrmCadCondPagamento.p_Select;
var sSQL : String;
begin
  sSQL := ' SELECT * FROM TB_CONDICAO_PAGAMENTO WHERE 1=1';
  if sCdCampo <> '' then
    sSQL := sSQL + ' AND cd_condicaopagamento LIKE '+QuotedStr(sCdCampo);
  QR_Padrao.Close;
  QR_Padrao.SQL.Clear;
  QR_Padrao.SQL.Add(sSQL);
  QR_Padrao.Open;
  QR_Padrao.First;
end;

procedure TfrmCadCondPagamento.DBEdit2Enter(Sender: TObject);
begin
  inherited;
  setCorEnter(Sender);
end;

procedure TfrmCadCondPagamento.DBEdit2Exit(Sender: TObject);
begin
  inherited;
  setCorExit(Sender);
end;

procedure TfrmCadCondPagamento.FormShow(Sender: TObject);
begin
  p_Select;
  inherited;
end;

end.
